﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:igWindows="http://infragistics.com/Windows"
	xmlns:igDP="http://infragistics.com/DataPresenter"
	xmlns:igEditors="http://infragistics.com/Editors">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="..\Shared.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<CornerRadius
	x:Key="TextEditorCornerRadius"
	TopLeft="2"
	TopRight="2"
	BottomRight="2"
	BottomLeft="2" />

	<Thickness
		x:Key="TextEditorBorderThickness"
		Left="1"
		Top="1"
		Right="1"
		Bottom="1" />

	<Thickness
		x:Key="TextEditorMargin"
		Left="1"
		Top="1"
		Right="1"
		Bottom="1" />

	<Thickness
		x:Key="TextEditorPadding"
		Left="5"
		Top="3"
		Right="5"
		Bottom="3" />

	<Style TargetType="{x:Type igEditors:XamTextEditor}">
		<Setter Property="Background" Value="{DynamicResource VOColor10}" />
		<Setter Property="Foreground" Value="{DynamicResource VOColorText}" />
		<Setter Property="BorderBrush" Value="{DynamicResource VOColor16}" />
		<Setter Property="BorderThickness" Value="1" />
		<Setter Property="Padding" Value="4,2,4,2" />
		<Setter Property="Margin" Value="{StaticResource TextEditorMargin}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
					<Border x:Name="MainBorder"
					    Background="{TemplateBinding Background}"
					    BorderBrush="{TemplateBinding BorderBrush}"
					    BorderThickness="{TemplateBinding BorderThickness}"
 						>
						<!-- SSP 10/3/07 BR25672 Took the following code out of Border element above since
									the TextBlock below is already setting that value. We don't want to substract
									the padding twice.
						    Margin="{TemplateBinding Padding}"-->
						<TextBlock x:Name="TextBlock"
							Margin="{TemplateBinding Padding}"
							Text="{TemplateBinding DisplayText}"
							TextWrapping="{TemplateBinding TextWrapping}"
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
							TextAlignment="{TemplateBinding TextAlignmentResolved}"
							Foreground="{TemplateBinding Foreground}"
						  />
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEmbedded" Value="False">
							<Setter TargetName="MainBorder" Property="CornerRadius" Value="1" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="EditTemplate">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
					<Border
						x:Name="MainBorder"
						Background="{TemplateBinding Background}"
						BorderBrush="{TemplateBinding BorderBrush}"
						BorderThickness="{TemplateBinding BorderThickness}"
 						>
						<!-- SSP 10/3/07 BR25672 Took the Margin="{TemplateBinding Padding}" code out of Border element above
								and instead added Padding="{TemplateBinding Padding}" to the TextBox below. Padding should not
								be outside the border and the background. It should be inside the border and around the editor's
								contents.-->
						<TextBox
							Name="PART_FocusSite"
							Padding="{TemplateBinding Padding}"
							Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
							TextWrapping="{TemplateBinding TextWrapping}"
							HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
							VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
							HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
							VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
							TextAlignment="{TemplateBinding TextAlignmentResolved}"
							IsReadOnly="{TemplateBinding ReadOnly}"
							MaxLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ValueConstraint.MaxLength, Mode=OneWay}"
							Background="Transparent"
							BorderBrush="Transparent"
							BorderThickness="0,0,0,0"
							Foreground="{TemplateBinding Foreground}"
							ContextMenu="{TemplateBinding ContextMenu}"
					  />
					</Border>
					<!-- 
					SSP 6/6/07 BR23366
					Added trigger that sets IsTabStop to False based on IsInEditMode setting.
					We need this in order to make the Tab and Shift+Tab navigation work properly.
					Apparently presense of nested textbox causes Shift+Tab to misbehave and cause
					the framwork to give focus to the parent ContentPresenter if the editor
					is inside a HeaderedContentControl. This is similar to what inbox ComboBox
					does.
					-->
					<ControlTemplate.Triggers>
						<Trigger Property="IsInEditMode" Value="True">
							<Setter Property="IsTabStop" Value="False" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Style.Triggers>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsEmbedded" Value="True"/>
					<Condition Property="IsInEditMode" Value="False"/>
				</MultiTrigger.Conditions>
				<Setter Property="Background" Value="{x:Null}"/>
				<Setter Property="BorderBrush" Value="{x:Null}"/>
			</MultiTrigger>
			<!-- SSP 1/8/08 BR29482 - Added setter for setting Foreground. 
			 We were already setting the Background explicitly above. If we don't
			 do this then the Foreground will be inherited but not the background. 
			 This causes a problem when the editor is inside an item of a ListBox 
			 and the item is selected. The item's back color turns blue and fore 
			 color turns white. However the editor inherits only the fore color
			 and causes the contents to turn white, essentially disappear since
			 the background is explicitly set to white above. Also TextBox 
			 explicitly sets both the Background and Foreground.
			-->
			<!--Trigger Property="IsEmbedded" Value="False">
				<Setter Property="Foreground" Value="#000000" />
			</Trigger-->
		</Style.Triggers>
	</Style>
	

</ResourceDictionary>